//
//  TLFGPswViewController.m
//  FunnyVideo
//
//  Created by 李鑫 on 15/11/3.
//  Copyright © 2015年 NewEggTech. All rights reserved.
//
#import "TLPswVerfyViewController.h"
#import "TLFGPswViewController.h"
#import <AVOSCloud/AVOSCloud.h>
@interface TLFGPswViewController ()


@end

@implementation TLFGPswViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)hidderKeyboard:(id)sender {
    [self.phoneTF resignFirstResponder];
}

- (IBAction)inputEnd:(id)sender {
    [self.phoneTF resignFirstResponder];
    //[self presentVFViewController];
}

/*
 [self.navigationController presentViewController:self.vfViewController animated:YES completion:^{
 
 }];
 */




#pragma mark - Navigation
- (BOOL)shouldPerformSegueWithIdentifier:(NSString *)identifier sender:(id)sender{
    if(self.phoneTF.text.length)
        return YES;
    else
        [TLAlertHelper showErrorHUDWithText:@"请输入手机号!"];
    
    return NO;
}
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    
    TLPswVerfyViewController *pswVFViewCtrl = (TLPswVerfyViewController *)segue.destinationViewController;
    
    pswVFViewCtrl.phone = self.phoneTF.text;


    [AVUser requestPasswordResetWithPhoneNumber:self.phoneTF.text block:^(BOOL succeeded, NSError *error) {
if(succeeded)
    [TLAlertHelper showSuccessHUDWithText:@"验证码已发送!"];
        else
            [TLAlertHelper showErrorHUDWithText:[error userInfo][@"error"]];
    }];
}


@end
